import request from '@/utils/request';
/**
 * 注册接口
 * @param {Object} param0 注册的参数
 */
export function registerAPI({ account, password, verifyCode, nickname }) {
    return request({
        url: '/register',
        method: 'POST',
        data: { account, password, verifyCode, nickname },
    });
}
/**
 * 登录接口
 * @param {Object} param0 登录的参数
 */
export function loginAPI({ account, password, verifyCode, actionType }) {
    return request({
        url: '/login',
        method: 'POST',
        data: { account, password, verifyCode, actionType },
    });
}
/**
 * 退出登录接口
 * @param {string} client 指定的客户端
 */
export function logoutAPI(client) {
    return request({
        url: '/logout',
        method: 'DELETE',
        data: { client },
    });
}
/**
 * 获取用户信息接口
 * @param {number} [uid] 用户id
 */
export function userInfoAPI(uid) {
    return request({
        url: '/user/info',
        method: 'GET',
        params: { uid },
    });
}
/**
 * 修改用户信息接口
 * @param {Object} param0 修改的数据
 */
export function resetInfoAPI({ nickname, gender, birthday, sign }) {
    return request({
        url: '/user/reset/info',
        method: 'PUT',
        data: { nickname, gender, birthday, sign },
    });
}
/**
 * 修改密码接口
 * @param {string} account 帐号
 * @param {*} verifyCode 验证码
 * @param {*} newPassword 新密码
 */
export function resetPasswordAPI(account, verifyCode, newPassword) {
    return request({
        url: '/user/reset/password',
        method: 'PUT',
        data: { account, verifyCode, newPassword },
    });
}
/**
 *  上传头像接口
 * @param {FIle} file 新头像
 */
export function uploadAvatarAPI(file) {
    const formData = new FormData();
    formData.append('file', file);
    formData.append('dir', 'avatar');
    return request({
        url: '/user/uploader/avatar',
        method: 'PUT',
        data: formData,
    });
}
